unit unitnuevopreinforme;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
  unitmainform, sqldb;

type

  { TFormNuevoPreinforme }

  TFormNuevoPreinforme = class(TForm)
    Button1: TButton;
    Button2: TButton;
    Edit1: TEdit;
    Label1: TLabel;
    Label2: TLabel;
    Memo1: TMemo;
    SQLQuery1: TSQLQuery;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure FormShow(Sender: TObject);
  private
    { private declarations }
  public
    { public declarations }
  end; 

var
  FormNuevoPreinforme: TFormNuevoPreinforme;

implementation

{$R *.lfm}

{ TFormNuevoPreinforme }

procedure TFormNuevoPreinforme.Button2Click(Sender: TObject);
begin
  Close();
end;

procedure TFormNuevoPreinforme.Button1Click(Sender: TObject);
begin
  Edit1.Text := uppercase(Edit1.Text);

  SQLQuery1.SQL.Text := 'insert into preinforme(prinf_titulo, prinf_texto) values(''' + Edit1.Text
    + ''', ''' + Memo1.Text + ''')';

  SQLQuery1.ExecSQL;

  ShowMessage('Alta Exitosa');
  Close();
end;

procedure TFormNuevoPreinforme.FormShow(Sender: TObject);
begin
  Edit1.Text := '';
  Memo1.Clear;

  Edit1.SetFocus;
end;

end.

